package com.wangzhixuan.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.wangzhixuan.commons.utils.PageInfo;
import com.wangzhixuan.model.Meeting;
import com.wangzhixuan.mapper.MeetingMapper;
import com.wangzhixuan.service.IMeetingService;
import com.baomidou.mybatisplus.plugins.Page;

import org.springframework.beans.factory.annotation.Autowired;

import com.baomidou.mybatisplus.service.impl.ServiceImpl;

import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zhixuan.wang
 * @since 2017-08-12
 */
@Service
public class MeetingServiceImpl extends ServiceImpl<MeetingMapper, Meeting> implements IMeetingService {
	
	@Autowired
    private MeetingMapper meetingMapper;
    
	@Override
    public void selectDataGrid(PageInfo pageInfo) {
    	Page<Map<String, Object>> page = new Page<Map<String, Object>>(pageInfo.getNowpage(), pageInfo.getSize());
        page.setOrderByField(pageInfo.getSort());
        page.setAsc(pageInfo.getOrder().equalsIgnoreCase("asc"));
        List<Meeting> list = meetingMapper.selectMeetingPage(page, pageInfo.getCondition());
        pageInfo.setRows(list);
        pageInfo.setTotal(page.getTotal());
    }

	@Override
	public Meeting selectMeeting(String workId, String meeting) {
		Meeting meeting2 = meetingMapper.selectMeeting(workId,meeting);
		return meeting2;
	}

	@Override
	public Meeting selectMeetingByUW(String workId) {
		Meeting selectMeetingByUW = meetingMapper.selectMeetingByUW(workId);
		return selectMeetingByUW;
	}

	@Override
	public Meeting selectMeetForBase(Integer userId, Integer workId) {
		// TODO Auto-generated method stub
		Meeting selectMeetForBase = meetingMapper.selectMeetForBase(userId, workId);
		return selectMeetForBase;
	}


}
